﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Xml;
using System.Xml.Serialization;


namespace IssueServiceLibrary
{
    [DataContract]
    public class User
    {
        [XmlAttribute]
        [DataMember]
        public string Name;

        [XmlAttribute]
        [DataMember]
        public string LoginId;

        [XmlAttribute]
        [DataMember]
        public string Email;

        [XmlAttribute]
        [DataMember]
        public string password;

        [XmlAttribute]
        [DataMember]
        public bool LoggedIn;

        [XmlAttribute]
        [DataMember]
        public PrivilidgeEnum PrivilidgeLevel;

        [DataContract(Name = "PrivilidgeCondition")]
        public enum PrivilidgeEnum
        {
            [EnumMember]
            NormalUser,
            [EnumMember]
            Administrator
        }
        
        public override string ToString()
        {
            return String.Format("Name: {0} Priv: {1}", Name, PrivilidgeLevel);
        }

        public override bool Equals(object obj)
        {
            User other = obj as User;
            return (other.LoginId.Equals(this.LoginId) && other.password.Equals(this.password));
        }


    }
}
